package com.shensi.adminCollect.enums.customer;

import java.util.HashMap;

public enum ElectricCardUsageTypeEnum {
    CHARGE("+","增加"),
    CONSUME("-","扣减"),
    ;

    private String key;

    private String name;

    ElectricCardUsageTypeEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    private static HashMap<String, ElectricCardUsageTypeEnum> keyMap;

    public static ElectricCardUsageTypeEnum getByKey(String key){
        if (keyMap == null) {
            HashMap<String, ElectricCardUsageTypeEnum> map = new HashMap<>();
            for (ElectricCardUsageTypeEnum value : ElectricCardUsageTypeEnum.values()) {
                map.put(value.getKey(),value);
            }
            keyMap = map;
        }
        return keyMap.get(key);
    }

}
